import request, { DataWrapper } from './req';
import * as vscode from 'vscode';

const config = vscode.workspace.getConfiguration('zd-vscode-tools');

export interface IDocData {
  desc: string
  id: number
  name: string,
  link: string
  router: string
  updatedAt: string
  createdAt: string
}

export function fetchApiDoc<T>(text:string):Promise<Partial<DataWrapper<T>>> {
  const url = config.docApiUrl;

  return request.get(`${url}?group=zd&router=${text}`);
}